﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConcurrentTools
{
    public class MethodResult
    {
        public static MethodResult Success = new MethodResult(true, "成功");

        public MethodResult(bool sucess, string msg)
        {
            this.IsSuccess = sucess;
            this.Message = msg;
        }

        public bool IsSuccess { get; set; }
        public string Message { get; set; }

        public static MethodResult<T> CreateRst<T>(bool success, string msg,T t)
        {
            return new MethodResult<T>(success, msg, t);
        }
    }

    public class MethodResult<T> : MethodResult
    {
        public MethodResult(bool sucess, string msg) : base(sucess, msg)
        {
        }

        public MethodResult(bool sucess, string msg, T t) : base(sucess, msg)
        {
            this.Data = t;
        }


        public T Data { get; set; }
    }
}
